package cn.jingzhuan.fm.network.json

import com.google.gson.annotations.SerializedName

/**
 * Created by Donglua on 15/9/9.
 */
class JsonResponse<T>(@field:SerializedName("code") var code: Int, @field:SerializedName("response") var response: T, @field:SerializedName("msg") var msg: String) {

    @SerializedName("ts")
    var ts: Long = 0

    val isSuccess: Boolean
        get() = code == 1

    val isInvestApiSuccess: Boolean
        get() = code == 0

    val isThemeServerSuccess: Boolean
        get() = code == 0

    override fun toString(): String {
        return "Response{" +
                "code=" + code +
                ", response=" + response +
                ", msg='" + msg + '\''.toString() +
                ", ts='" + ts + '\''.toString() +
                '}'.toString()
    }
}
